//PoetryItem.qml
import QtQuick 2.15
import org.ukui.memmonitor 1.0

Rectangle {
    implicitWidth: 180
    implicitHeight: 40
    radius: 6
    color: Qt.rgba(255, 255, 255, 0.5)
    border.color: "black"

    Memmonitor {
        id: memmonitor
    }

    Text {
        id: text
        anchors.centerIn: parent
        text: "内存占用：" + memmonitor.getMemUsage
        font.pointSize: 12
    }

    Component.onCompleted: {
        memmonitor.memChanged.connect(() => {
            text.text = "内存占用：" + memmonitor.getMemUsage
        })
    }

    Component.onDestruction: {
        if (memmonitor) {
            memmonitor.memChanged.disconnect()
        }
    }


}